package com.work.vo.main;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.work.utils.BigDecimalSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.Func;

import java.math.BigDecimal;

/**
 * 场存VO
 *
 * @author ：dujianyu
 * @since ：Created in 2024/3/26 8:52
 */
@Data
public class ShipBillStorageVO {

    /** ID */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "ID",notes = "")
    private Long id ;
    /** 货运船ID */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "货运船ID",notes = "")
    private Long transportShipId ;
    /** 货运舱单ID */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "货运舱单ID",notes = "")
    private Long transportBillId ;
    /** 理货舱单ID */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "理货舱单ID",notes = "")
    private Long tShipBillId ;
    /** 区域ID */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "区域ID",notes = "")
    private Long areaId ;
    /** 区域名称 */
    @ApiModelProperty(name = "区域名称",notes = "")
    private String areaName ;
    /** 场区ID */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "场区ID",notes = "")
    private Long positionId ;
    /** 场区名称 */
    @ApiModelProperty(name = "场区名称",notes = "")
    private String positionName ;
    /** 具体位置 */
    @ApiModelProperty(name = "具体位置",notes = "")
    private String spot ;

    @ApiModelProperty(name = "场区名称",notes = "")
    private String positionInfo ;

    public String getPositionInfo() {
        if(Func.isNull(positionName) || Func.isNull(spot)) {
            return "";
        }
        return positionName + "/" + spot;
    }

    /** 包装 */
    @ApiModelProperty(name = "包装",notes = "")
    private String packageType ;
    /** 包装 */
    @ApiModelProperty(name = "包装",notes = "")
    private String packageTypeName ;
    /** 件 */
    @ApiModelProperty(name = "件",notes = "")
    private Integer piece ;
    /** 吨 */
    @JsonSerialize(using = BigDecimalSerializer.class)
    @ApiModelProperty(name = "吨",notes = "")
    private BigDecimal ton ;

    @ApiModelProperty(name = "件吨信息",notes = "")
    private String pieceTonInfo ;

    public String getPieceTonInfo() {
        if (Func.isNull(piece) || Func.isNull(ton)) {
            return "";
        }
        return piece + "/" + ton.stripTrailingZeros().toPlainString();
    }

    /** 是否有效 */
    @ApiModelProperty(name = "是否有效",notes = "")
    private String isActive ;
    /** 货垛地图数据ID */
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "货垛地图数据ID",notes = "")
    private Long goodsPositionId ;
    /** 区域code */
    @ApiModelProperty(name = "区域code",notes = "")
    private String areaCode ;

}
